package com.xkang.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegUtils {

    public static String reg_all_keywords(String data){

        Pattern pattern = Pattern.compile(".*\\[:(.+)\\].*");
        Matcher matcher = pattern.matcher(data);
        if(matcher.find()){
            return  matcher.group(1);
        }
        return "" ;

    }

    public static String reg_args(String keyword){
        Pattern pattern = Pattern.compile(".*\\((.+)\\).*");
        Matcher matcher = pattern.matcher(keyword);
        if(matcher.find()){
            return  matcher.group(1);
        }
        return "" ;
    }

    public static String reg_class_name(String keyword){
        Pattern pattern = Pattern.compile(".*\\[(.+):\\].*");
        Matcher matcher = pattern.matcher(keyword);
        if(matcher.find()){
            return  matcher.group(1);
        }
        return "" ;
    }

    public static String reg_method(String keyword){
        Pattern pattern = Pattern.compile("(.+)\\(.*");
        Matcher matcher = pattern.matcher(keyword);
        if(matcher.find()){
            return  matcher.group(1);
        }
        return "" ;
    }
}
